﻿* Encoding: UTF-8.
dataset close all.
*syntax for regional level data.

cd 'C:\Users\tsipma\surfdrive\Wetenschappelijke artikelen\Emilien-David-Take\Data'.


*open base file (based on regioncode; manually constructed)'.
*France.
GET DATA
  /TYPE=XLSX
  /FILE='C:\Users\tsipma\surfdrive\Wetenschappelijke artikelen\Emilien-David-Take\Data\Regional '+
    'data\Regional GDP per capita UK France.xlsx'
  /SHEET=name 'GDP France'
  /CELLRANGE=FULL
  /READNAMES=ON
  /DATATYPEMIN PERCENTAGE=95.0
  /HIDDEN IGNORE=YES.
EXECUTE.

*link region to code.
compute regioncode_fr = -99.
if (nutscode = 'FRI1') regioncode_fr = 801.
if (nutscode = 'FRF2') regioncode_fr = 802.
if (nutscode = 'FRY') regioncode_fr = 803.
if (nutscode = 'FR1') regioncode_fr = 804.
if (nutscode = 'FRJ1') regioncode_fr = 805.
if (nutscode = 'FRF3') regioncode_fr = 806.
if (nutscode = 'FRE1') regioncode_fr = 807.
if (nutscode = 'FRG0') regioncode_fr = 808.
if (nutscode = 'FRK') regioncode_fr = 809.
if (nutscode = 'FRJ2') regioncode_fr = 801.
if (nutscode = 'FRE2') regioncode_fr = 802.
if (nutscode = 'FRL0') regioncode_fr = 805.
if (nutscode = 'FRF1') regioncode_fr = 806.
if (nutscode = 'FRH0') regioncode_fr = 808.
if (nutscode = 'FRI2') regioncode_fr = 801.
if (nutscode = 'FRD2') regioncode_fr = 802.
if (nutscode = 'FRM0') regioncode_fr = 805.
if (nutscode = 'FRC2') regioncode_fr = 806.
if (nutscode = 'FRI3') regioncode_fr = 808.

*fre regioncode_fr.
*cro nutslevel by regioncode_fr.

DATASET DECLARE gdp_france.
SORT CASES BY regioncode_fr.
AGGREGATE
  /OUTFILE='gdp_france'
  /PRESORTED
  /BREAK=regioncode_fr
  /gdp_2011=MEAN(gdp_2011_old) 
  /gdp_2012=MEAN(gdp_2012_old) 
  /gdp_2013=MEAN(gdp_2013_old) 
  /gdp_2014=MEAN(gdp_2014_old) 
  /gdp_2015=MEAN(gdp_2015_old) 
  /gdp_2016=MEAN(gdp_2016_old) 
  /gdp_2017=MEAN(gdp_2017_old) 
  /gdp_2018=MEAN(gdp_2018_old) 
  /gdp_2019=MEAN(gdp_2019_old) 
  /gdp_2020=MEAN(gdp_2020_old) 
  /gdp_2021=MEAN(gdp_2021_old) 
  /gdp_2022=MEAN(gdp_2022_old).

select if regioncode_fr ne -99.
compute regioncode=regioncode_fr.


SAVE OUTFILE='C:\Users\tsipma\surfdrive\Wetenschappelijke artikelen\Emilien-David-Take\Data\Regional data\GDP France.sav'
  /COMPRESSED.


*UK.
dataset close all.
GET DATA
  /TYPE=XLSX
  /FILE='C:\Users\tsipma\surfdrive\Wetenschappelijke artikelen\Emilien-David-Take\Data\Regional '+
    'data\Regional GDP per capita UK France.xlsx'
  /SHEET=name 'GDP UK'
  /CELLRANGE=FULL
  /READNAMES=ON
  /DATATYPEMIN PERCENTAGE=95.0
  /HIDDEN IGNORE=YES.
EXECUTE.

*pounds to euros.
*source: https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/eurofxref-graph-gbp.en.html

*1.1633.
compute gdp_2011 = gdp_2011_pound * 1.1522.
compute gdp_2012 = gdp_2012_pound * 1.2253.
compute gdp_2013 = gdp_2013_pound * 1.1995.
compute gdp_2014 = gdp_2014_pound * 1.2839.
compute gdp_2015 = gdp_2015_pound * 1.3625.
compute gdp_2016 = gdp_2016_pound * 1.2203.
compute gdp_2017 = gdp_2017_pound * 1.1407.
compute gdp_2018 = gdp_2018_pound * 1.1303.
compute gdp_2019 = gdp_2019_pound * 1.1393.
compute gdp_2020 = gdp_2020_pound * 1.124.
compute gdp_2021 = gdp_2021_pound * 1.1633.
compute gdp_2022 = gdp_2022_pound * 1.1727.

if (ITLcode = 'TLF') regioncode = 201.
if (ITLcode = 'TLH') regioncode = 202.
if (ITLcode = 'TLI') regioncode = 203.
if (ITLcode = 'TLC') regioncode = 204.
if (ITLcode = 'TLD') regioncode = 205.
if (ITLcode = 'TLN') regioncode = 206.
if (ITLcode = 'TLM') regioncode = 207.
if (ITLcode = 'TLJ') regioncode = 208.
if (ITLcode = 'TLK') regioncode = 209.
if (ITLcode = 'TLL') regioncode = 210.
if (ITLcode = 'TLG') regioncode = 211.
if (ITLcode = 'TLE') regioncode = 212.


SAVE OUTFILE='C:\Users\tsipma\surfdrive\Wetenschappelijke artikelen\Emilien-David-Take\Data\Regional data\GDP UK.sav'
  /COMPRESSED.






